﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KeaoBase;

namespace KeaoMDS.Report
{
    public partial class CheLiangChaoShi : BaseForm
    {
        public CheLiangChaoShi()
        {
            InitializeComponent();
        }

        private void CheLiangChaoShi_Load(object sender, EventArgs e)
        {
            grid_chaoshi.AutoGenerateColumns = false;
            dateTimePicker1.Value = DateTime.Today;
            dateTimePicker2.Value = dateTimePicker1.Value.AddHours(23).AddMinutes(59).AddSeconds(59);
            BindInfo();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BindInfo();
        }


        private void BindInfo()
        {
            string createCondition = KeaoUtils._DB.CreateAndCondition("chuchangshijian", DataValueCommonType.日期时间, dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss"), SearchConditionType.between);
            if (!string.IsNullOrEmpty(txt_chepaihao.Text))
            {
                createCondition += KeaoUtils._DB.CreateAndCondition("chepaihao", DataValueCommonType.字符串, txt_chepaihao.Text, "", SearchConditionType.like);
            }
            Dictionary<string, string> orderBy = new Dictionary<string, string>();
            orderBy.Add("chuchangshijian", "desc");
            DataTable Dt = KeaoUtils._DB.GetDataTableByCondition("tbl_chaoshi", createCondition, orderBy);
            grid_chaoshi.DataSource = Dt;
        }


    }
}
